"""
元组的定义和操作
"""

# # 定义元组
# t1 = (1, "Hello", True)
# print(f"t1的类型是：{type(t1)}, 内容是：{t1}")
#
# # 定义单个元素的元素
# t2 = ("hello", )
# print(f"类型{type(t2)}, 内容{t2}")
#
# # 元组的嵌套
# t3 = ( (1, 2, 3), (4, 5, 6) )
# print(f"类型{type(t3)}, 内容{t3}")
#
# # 下标索引去取出内容
# num = t3[1][2]
# print(f"{num}")
#
# # 元组的操作：index查找方法
# t4 = ("我真的", "很好", "Python")
# index = t4.index("我真的")
# print(f"下标{index}")

# 元组的操作：count统计方法
t5 = ("我真的", "我真的", "我真的", "很累", "的")
num = t5.count("我真的")
print(f"我真的数量{num}")

# while遍历
index = 0
while index < len(t5):
    print(f"元组：{t5[index]}")
    # 至关重要
    index += 1

# for遍历
for element in t5:
    print(f"2元组：{element}")
